<?php
require 'php/database.php';
try{

if(!isset($_GET['register']))
{
	 
	


echo "

<head>
</head>
<body>
You are not Registered in our System.
Kindly fill the following form and we will review your request

<form action=\"?register\" method=\"POST\">  
Name: <input type=\"text\" name=\"name\"><br>
EmailID: <input type=\"text\" name=\"email\"><br>

User Type:<br>

<input type=\"radio\" name=\"X\" value=\"phd\">PHD<br>
<input type=\"radio\" name=\"X\" value=\"advisor\">Advisor<br>
<input type=\"radio\" name=\"X\" value=\"pgc\">PGC<br>
<input type=\"radio\" name=\"X\" value=\"office\">Office<br>


<input type=\"submit\" value=\"Submit\">
<input type=\"reset\" value=\"Reset\"><br>


</form>


</body>
";
}
else{
	$db = new DatabaseManager();
	$connection = $db->getDB();
	echo "(".$_POST['name'].",".$_POST['email'].",".$_POST['X'].")";
	$query = "insert into new_user values('".$_POST['name']."','".$_POST['email']."','".$_POST['X']."')";
	$result = mysqli_query($connection,$query);
	if($result){
		echo "Your details have been forwarded to the admin, who will be looking into your request.";
	}
	else {
		echo "Soemthing is wrong!";
	}
}
}catch(Exception $e) {}

?>